/*
 * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
 *
 * https://www.mall4j.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */
package com.yami.shop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.model.SupplierCategory;
import com.yami.shop.dao.SupplierCategoryMapper;
import com.yami.shop.service.SupplierCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Citrus
 * @date 2021-09-07 10:12:32
 */
@Service
public class SupplierCategoryServiceImpl extends ServiceImpl<SupplierCategoryMapper, SupplierCategory> implements SupplierCategoryService {
    @Autowired
    private SupplierCategoryMapper supplierCategoryMapper;

    @Override
    @Cacheable(cacheNames = "listSupplierCategory", key = "#shopId+ ':' + #isAll")
    public List<SupplierCategory> listSupplierCategory(Long shopId, Integer isAll) {
        return supplierCategoryMapper.listSupplierCategory(shopId, isAll);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void changeCategory(Long supplierCategoryId) {
        supplierCategoryMapper.changeCategory(supplierCategoryId);
    }

    @Override
    @CacheEvict(cacheNames = "listSupplierCategory", key = "#shopId+ ':' + #isAll")
    public void removeSupplierCategoryCache(Long shopId, Integer isAll) {

    }
}
